package hibernate.entities;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="user")
public class User {
	public static final int NORMAL = 0;
	public static final int CONTENT = 1;
	public static final int TRISTE = 2;
	public static final int FATIGUE = 3;
	public static final int FIER = 4;
	public static final int DUBITATIF = 5;
	public static final int AMOUREUX = 6;
	public static final int ENERVE = 7;
	public static final int LAPIN = 8;
	public static final int ETONNE = 9;
	public static final int MALADE = 10;

	@Id
	@Column(name="id")
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id;
	
	private String identifiant;
	private String nom;
	private int taille;
	private int humeur;
	private char sexe;
	private boolean connecte;
    
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name = "fk_piece")
	private Piece piece;

	@OneToMany(mappedBy="emetteur", fetch=FetchType.LAZY)
	private Set<Message> messagesEnvoyes;

	@OneToMany(mappedBy="recepteur", fetch=FetchType.LAZY)
	private Set<Message> messagesRecus;

	public Set<Message> getMessagesEnvoyes() {
		return messagesEnvoyes;
	}


	public void setMessagesEnvoyes(Set<Message> messagesEnvoyes) {
		this.messagesEnvoyes = messagesEnvoyes;
	}


	public Set<Message> getMessagesRecus() {
		return messagesRecus;
	}


	public void setMessagesRecus(Set<Message> messagesRecus) {
		this.messagesRecus = messagesRecus;
	}


	public User(){
	}


	public User(String identifiant, String nom, int taille, char sexe, int humeur,
			boolean connecte, Piece piece) {
		super();
		this.identifiant = identifiant;
		this.nom = nom;
		this.taille = taille;
		this.sexe = sexe;
		this.humeur = humeur;
		this.connecte = connecte;
		this.piece = piece;
	}


	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}


	public String getIdentifiant() {
		return identifiant;
	}


	public void setIdentifiant(String identifiant) {
		this.identifiant = identifiant;
	}


	public String getNom() {
		return nom;
	}


	public void setNom(String nom) {
		this.nom = nom;
	}


	public int getTaille() {
		return taille;
	}


	public void setTaille(int taille) {
		this.taille = taille;
	}

	public char getSexe() {
		return sexe;
	}


	public void setSexe(char sexe) {
		this.sexe = sexe;
	}

	public int getHumeur() {
		return humeur;
	}


	public void setHumeur(int humeur) {
		this.humeur = humeur;
	}


	public boolean isConnecte() {
		return connecte;
	}


	public void setConnecte(boolean connecte) {
		this.connecte = connecte;
	}


	public Piece getPiece() {
		return piece;
	}


	public void setPiece(Piece piece) {
		this.piece = piece;
	}
	
	
}
